//package com.xgk.boot.framework.redis.config;
//
//import org.redisson.Redisson;
//import org.redisson.api.RedissonClient;
//import org.redisson.codec.JsonJacksonCodec;
//import org.redisson.config.Config;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//@Configuration
//public class RedissonConfig {
//
//    @Value("${spring.data.redis.host}")
//    private String redisHost;
//
//    @Value("${spring.data.redis.port}")
//    private String redisPort;
//
//    @Value("${spring.data.redis.password}")
//    private String redisPassword;
//
//    @Value("${spring.data.redis.database}")
//    private int redisDatabase;
//
//    @Bean(destroyMethod = "shutdown")
//    public RedissonClient redissonClient() {
//        Config config = new Config();
//        config.setCodec(new JsonJacksonCodec());
//
//        config.useSingleServer()
//                .setAddress("redis://" + redisHost + ":" + redisPort)
//                .setDatabase(redisDatabase)
//                .setConnectionPoolSize(64)
//                .setConnectionMinimumIdleSize(10)
//                .setIdleConnectionTimeout(10000)
//                .setConnectTimeout(10000)
//                .setTimeout(3000)
//                .setRetryAttempts(3)
//                .setRetryInterval(1500)
//                .setSubscriptionConnectionPoolSize(50)
//                .setSubscriptionConnectionMinimumIdleSize(1);
//        if(redisPassword != null && !redisPassword.isEmpty()) {
//            config.useSingleServer().setPassword(redisPassword);
//        }
//        return Redisson.create(config);
//    }
//
////    @Bean
////    public CacheManager cacheManager(RedissonClient redissonClient) {
////        return new RedissonSpringCacheManager(redissonClient);
////    }
//}
